package com.epam.springtest.api;

import com.epam.springtest.dao.UserDao;
import com.epam.springtest.service.UserServiceImpl;
import org.springframework.context.support.GenericXmlApplicationContext;

/**
 * @author Mikalai Kisel
 */
public class JdbcUserDaoSample {
    public static void main(String[] args) {

        GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
        ctx.load("classpath:datasource-manager.xml");
        ctx.refresh();
        UserDao userDao = ctx.getBean("userDao", UserDao.class);
        UserServiceImpl userService = new UserServiceImpl();
        userService.setUserDao(userDao);

        System.out.println("First name for contact id 1 is: " +
                userDao.findUserByEmail("1@epam.com"));

        System.out.println(userService.checkUser("1@epam.com", "Kise"));
    }
}
